package lab1;

import java.util.Scanner;
public class Test12 {
    public static void main(String[] args) {
        System.out.println("please input number in 1~9999");
        int number;
        number = new Scanner(System.in).nextInt();
        int a;                                          //定义千位
        int b;                                          //定义百位
        int c;                                          //定义十位
        int d;                                          //定义个位
        if (number > 999) {
            System.out.println("这是一个四位数");
            a = number / 1000;
            b = number % 1000 / 100;
            c = number % 100 / 10;
            d = number % 10;
            if (a == d && b == c) {
                System.out.println("是回文");
            } else
                System.out.println("不是回文");
        } else if (number > 99) {
            System.out.println("这是一个三位数");
            b = number / 100;
            c = number % 100 / 10;
            d = number % 10;
            if (b == d) {
                System.out.println("是回文");
            } else
                System.out.println("不是回文");
        } else if (number > 9) {
            System.out.println("这是一个两位数");
            c = number / 10;
            d = number % 10;
            if (c == d) {
                System.out.println("是回文");
            } else
                System.out.println("不是回文");


        }else {
            System.out.println("这是一个一位数");
            System.out.println("不是回文");
        }
    }
}
